//
//  CZProfileViewController.swift
//  GZWeibo666
//
//  Created by Apple on 16/04/22.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class CZProfileViewController: CZBaseTableViewController {

    let cellTitleArr =
        [["cellTitle":"我的相册","iconName":"album"],
         ["cellTitle":"新手任务","iconName":"draft"],
         ["cellTitle":"我的赞","iconName":"like"],
         ["cellTitle":"我的好友","iconName":"new_friend"],
         ["cellTitle":"微博支付","iconName":"pay"],
         ["cellTitle":"微博运动","iconName":"vip"],
         ["cellTitle":"我的名片","iconName":"card"],
         ["cellTitle":"更多","iconName":"collect"]]
    
    override func viewDidLoad() {
        super.viewDidLoad()
//        self.tableView
        
        /// 关闭滚动
//        self.tableView.scrollEnabled = false
    }

    // MARK: - Table view data source
    
    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }
    
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return cellTitleArr.count
    }
    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        
        let cell:UITableViewCell = UITableViewCell()
        cell.textLabel?.text = cellTitleArr[indexPath.row]["cellTitle"]
        cell.imageView?.image = UIImage(named: cellTitleArr[indexPath.row]["iconName"]!)
        
        cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
        return cell
    }
    
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        print("'点击选中了cell")
        
        //获取被点击的cell
        let cell:UITableViewCell = tableView.cellForRowAtIndexPath(indexPath)!
        
        let testVc = CZTestViewController()
        testVc.title = cell.textLabel?.text
        navigationController?.pushViewController(testVc, animated: true)
    }
    
    
    
    override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    
         //添加headView
        let headView = CZHeadView()
     return  headView
    }
    
    
    override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 150
    }
    

}
